package models;

import java.util.Date;



import play.data.validation.Required;
import siena.*;

public class EventInfo extends Model {

	
	/**
	 * Template type 0
	 */
	@Id(Generator.AUTO_INCREMENT)
	private Long id;
	@Index("event_index")  
	private Event event;
	@NotNull
	private String description;
	private double latitude;
	private double longitude;
	@NotNull
	private Date startDate;
	@NotNull
	private Date endDate;
	private int maximumGuests;
	private Date created;
	private Date modified;
	
	
	public EventInfo(String description, double lat, double lng, Date startDate, Date endDate, int max){
		super();
		this.description = description;
		this.latitude = lat;
		this.longitude = lng;
		this.startDate = startDate;
		this.endDate = endDate;
		this.maximumGuests = max;
		this.created = new Date();
		this.modified = created;
	}
	
	public static Query<EventInfo>all(){
		return Model.all(EventInfo.class);
	}
	
	public static EventInfo findByEvent(Event event){
		return all().filter("event", event).get();
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Event getEvent() {
		return event;
	}

	public void setEvent(Event event) {
		this.event = event;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public double getLatitude() {
		return latitude;
	}

	public void setLatitude(double latitude) {
		this.latitude = latitude;
	}

	public double getLongitude() {
		return longitude;
	}

	public void setLongitude(double longitude) {
		this.longitude = longitude;
	}

	public Date getStartDate() {
		return startDate;
	}

	public void setStartDate(Date startDate) {
		this.startDate = startDate;
	}

	public Date getEndDate() {
		return endDate;
	}

	public void setEndDate(Date endDate) {
		this.endDate = endDate;
	}

	public int getMaximumGuests() {
		return maximumGuests;
	}

	public void setMaximumGuests(int maximumGuests) {
		this.maximumGuests = maximumGuests;
	}

	public Date getCreated() {
		return created;
	}

	public void setCreated(Date created) {
		this.created = created;
	}

	public Date getModified() {
		return modified;
	}

	public void setModified(Date modified) {
		this.modified = modified;
	}
	
	
	
	
	
	
}
